package com.globallogic.learning.kozius.actor;

import com.globallogic.learning.kozius.entity.Lesson;

import java.util.ArrayList;
import java.util.List;

/**
 * Class describes the Teacher actor.
 * <p/>
 * Created by sergii.koziumynskyi on 2/4/14.
 */
public final class Teacher extends People {
    public Teacher(String firstName, String lastName, int yearOfBirth, int monthOfBirth, int dayOfBirth, String placeOfBirth, List<Lesson> teachLessons) {
        super(firstName, lastName, yearOfBirth, monthOfBirth, dayOfBirth, placeOfBirth);
        this.teachLessons = teachLessons;
    }

    public Teacher(String firstName, String lastName, List<Lesson> teachLessons) {
        super(firstName, lastName);
        this.teachLessons = teachLessons;
    }

    public Teacher(List<Lesson> teachLessons) {
        this.teachLessons = teachLessons;
    }

    public Teacher() {
    }

    public List<Lesson> getTeachLessons() {
        return teachLessons;
    }

    public void setTeachLessons(List<Lesson> teachLessons) {
        this.teachLessons = teachLessons;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Teacher)) return false;
        if (!super.equals(o)) return false;

        Teacher teacher = (Teacher) o;

        if (id != teacher.id) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = super.hashCode();
        result = 31 * result + id;
        result = 31 * result + teachLessons.hashCode();
        return result;
    }

    @Override
    public String toString() {
        return "Teacher{" +
                "id=" + id +
                ", teachLessons=" + teachLessons +
                "} " + super.toString();
    }

    private int id;
    private List<Lesson> teachLessons = new ArrayList<Lesson>();
    private static int nextId = 200000000;  // 2 prefix will show that it is a teacher

    {
        id = nextId;
        nextId++;
    }
}
